<?php
namespace app\manager\controller;
use app\manager\model;
/**
 * 回复文本消息
 */
class TextMsg extends Base
{
	public function index(){
		$list = $this->model->all();
		return $this->fetch('', ['list' => $list]);			
	}
	
	public function create(){
		return $this->fetch();		
	}
	
	public function save(){
		$jquery = ['method' => 'saveTextMsgs', 'success' => '/textmsg', 'error' => null];
		$this->store($this->request->post(['type'=>1]), $jquery, function(){});
	}
	
	public function edit($id){
		$data = $this->model->find($id);
		return $this->fetch('', ['data' => $data]);		
	}
	
	public function update(){
		$jquery = ['method' => 'updateTextMsgs', 'success' => '/textmsg', 'error' => null];
		$this->store($this->request->param(['type'=>1]), $jquery, function(){});
	}		
	
	public function delete($id){
		$re = $this->model->destroy($id);	  
		return 1;
	}
}



?>